package reflect;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Scanner;

public class ReflectDemo5 {
    public static void main(String[] args) throws ClassNotFoundException, InstantiationException, IllegalAccessException, NoSuchMethodException, InvocationTargetException {


        Scanner sc = new Scanner(System.in);
        System.out.println("请输入完全限定类名：");
        Class cls = Class.forName(sc.nextLine());
        Object o = cls.newInstance();
        Method method = cls.getMethod("say", String.class);
        method.invoke(o,"大家好");



    }
}
